\doxysection{x\+Queue\+Send }
\hypertarget{group__x_queue_send}{}\label{group__x_queue_send}\index{xQueueSend@{xQueueSend}}
queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSendToToFront(                                QueueHandle\_t    xQueue,                                const void       *pvItemToQueue,                                TickType\_t       xTicksToWait                            );
  \end{DoxyPre}


Post an item to the front of a queue. The item is queued by copy, not by reference. This function must not be called from an interrupt service routine. See x\+Queue\+Send\+From\+ISR () for an alternative which may be used in an ISR.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em x\+Ticks\+To\+Wait} & The maximum amount of time the task should block waiting for space to become available on the queue, should it already be full. The call will return immediately if this is set to 0 and the queue is full. The time is defined in tick periods so the constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS should be used to convert to real time if this is required.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the item was successfully posted, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage\+: 
\begin{DoxyPre}
struct AMessage
\{
   char ucMessageID;
   char ucData[ 20 ];
\} xMessage;

uint32\_t ulVar = 10UL;

void vATask( void *pvParameters )
\{
QueueHandle\_t xQueue1, xQueue2;
struct AMessage *pxMessage;

   // Create a queue capable of containing 10 uint32\_t values.
   xQueue1 = xQueueCreate( 10, sizeof( uint32\_t ) );

   // Create a queue capable of containing 10 pointers to AMessage structures.
   // These should be passed by pointer as they contain a lot of data.
   xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );

   // ...

   if( xQueue1 != 0 )
   \{
    // Send an uint32\_t.  Wait for 10 ticks for space to become
    // available if necessary.
    if( xQueueSendToFront( xQueue1, ( void * ) \&ulVar, ( TickType\_t ) 10 ) != pdPASS )
    \{
        // Failed to post the message, even after 10 ticks.
    \}
   \}

   if( xQueue2 != 0 )
   \{
    // Send a pointer to a struct AMessage object.  Don't block if the
    // queue is already full.
    pxMessage = \& xMessage;
    xQueueSendToFront( xQueue2, ( void * ) \&pxMessage, ( TickType\_t ) 0 );
   \}

   // ... Rest of task code.
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSendToBack(                                QueueHandle\_t    xQueue,                                const void       *pvItemToQueue,                                TickType\_t       xTicksToWait                            );
  \end{DoxyPre}


This is a macro that calls x\+Queue\+Generic\+Send().

Post an item to the back of a queue. The item is queued by copy, not by reference. This function must not be called from an interrupt service routine. See x\+Queue\+Send\+From\+ISR () for an alternative which may be used in an ISR.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em x\+Ticks\+To\+Wait} & The maximum amount of time the task should block waiting for space to become available on the queue, should it already be full. The call will return immediately if this is set to 0 and the queue is full. The time is defined in tick periods so the constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS should be used to convert to real time if this is required.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the item was successfully posted, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage\+: 
\begin{DoxyPre}
struct AMessage
\{
   char ucMessageID;
   char ucData[ 20 ];
\} xMessage;

uint32\_t ulVar = 10UL;

void vATask( void *pvParameters )
\{
QueueHandle\_t xQueue1, xQueue2;
struct AMessage *pxMessage;

   // Create a queue capable of containing 10 uint32\_t values.
   xQueue1 = xQueueCreate( 10, sizeof( uint32\_t ) );

   // Create a queue capable of containing 10 pointers to AMessage structures.
   // These should be passed by pointer as they contain a lot of data.
   xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );

   // ...

   if( xQueue1 != 0 )
   \{
    // Send an uint32\_t.  Wait for 10 ticks for space to become
    // available if necessary.
    if( xQueueSendToBack( xQueue1, ( void * ) \&ulVar, ( TickType\_t ) 10 ) != pdPASS )
    \{
        // Failed to post the message, even after 10 ticks.
    \}
   \}

   if( xQueue2 != 0 )
   \{
    // Send a pointer to a struct AMessage object.  Don't block if the
    // queue is already full.
    pxMessage = \& xMessage;
    xQueueSendToBack( xQueue2, ( void * ) \&pxMessage, ( TickType\_t ) 0 );
   \}

   // ... Rest of task code.
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueSend(                           QueueHandle\_t xQueue,                           const void * pvItemToQueue,                           TickType\_t xTicksToWait                      );
  \end{DoxyPre}


This is a macro that calls x\+Queue\+Generic\+Send(). It is included for backward compatibility with versions of Free\+RTOS.\+org that did not include the x\+Queue\+Send\+To\+Front() and x\+Queue\+Send\+To\+Back() macros. It is equivalent to x\+Queue\+Send\+To\+Back().

Post an item on a queue. The item is queued by copy, not by reference. This function must not be called from an interrupt service routine. See x\+Queue\+Send\+From\+ISR () for an alternative which may be used in an ISR.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em x\+Ticks\+To\+Wait} & The maximum amount of time the task should block waiting for space to become available on the queue, should it already be full. The call will return immediately if this is set to 0 and the queue is full. The time is defined in tick periods so the constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS should be used to convert to real time if this is required.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the item was successfully posted, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage\+: 
\begin{DoxyPre}
struct AMessage
\{
   char ucMessageID;
   char ucData[ 20 ];
\} xMessage;

uint32\_t ulVar = 10UL;

void vATask( void *pvParameters )
\{
QueueHandle\_t xQueue1, xQueue2;
struct AMessage *pxMessage;

   // Create a queue capable of containing 10 uint32\_t values.
   xQueue1 = xQueueCreate( 10, sizeof( uint32\_t ) );

   // Create a queue capable of containing 10 pointers to AMessage structures.
   // These should be passed by pointer as they contain a lot of data.
   xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );

   // ...

   if( xQueue1 != 0 )
   \{
    // Send an uint32\_t.  Wait for 10 ticks for space to become
    // available if necessary.
    if( xQueueSend( xQueue1, ( void * ) \&ulVar, ( TickType\_t ) 10 ) != pdPASS )
    \{
        // Failed to post the message, even after 10 ticks.
    \}
   \}

   if( xQueue2 != 0 )
   \{
    // Send a pointer to a struct AMessage object.  Don't block if the
    // queue is already full.
    pxMessage = \& xMessage;
    xQueueSend( xQueue2, ( void * ) \&pxMessage, ( TickType\_t ) 0 );
   \}

   // ... Rest of task code.
\}
\end{DoxyPre}


queue. h 
\begin{DoxyPre}
BaseType\_t xQueueGenericSend(                                 QueueHandle\_t xQueue,                                 const void * pvItemToQueue,                                 TickType\_t xTicksToWait                                 BaseType\_t xCopyPosition                             );
  \end{DoxyPre}


It is preferred that the macros x\+Queue\+Send(), x\+Queue\+Send\+To\+Front() and x\+Queue\+Send\+To\+Back() are used in place of calling this function directly.

Post an item on a queue. The item is queued by copy, not by reference. This function must not be called from an interrupt service routine. See x\+Queue\+Send\+From\+ISR () for an alternative which may be used in an ISR.


\begin{DoxyParams}{Parameters}
{\em x\+Queue} & The handle to the queue on which the item is to be posted.\\
\hline
{\em pv\+Item\+To\+Queue} & A pointer to the item that is to be placed on the queue. The size of the items the queue will hold was defined when the queue was created, so this many bytes will be copied from pv\+Item\+To\+Queue into the queue storage area.\\
\hline
{\em x\+Ticks\+To\+Wait} & The maximum amount of time the task should block waiting for space to become available on the queue, should it already be full. The call will return immediately if this is set to 0 and the queue is full. The time is defined in tick periods so the constant port\+TICK\+\_\+\+PERIOD\+\_\+\+MS should be used to convert to real time if this is required.\\
\hline
{\em x\+Copy\+Position} & Can take the value queue\+SEND\+\_\+\+TO\+\_\+\+BACK to place the item at the back of the queue, or queue\+SEND\+\_\+\+TO\+\_\+\+FRONT to place the item at the front of the queue (for high priority messages).\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
pd\+TRUE if the item was successfully posted, otherwise err\+QUEUE\+\_\+\+FULL.
\end{DoxyReturn}
Example usage\+: 
\begin{DoxyPre}
struct AMessage
\{
   char ucMessageID;
   char ucData[ 20 ];
\} xMessage;

uint32\_t ulVar = 10UL;

void vATask( void *pvParameters )
\{
QueueHandle\_t xQueue1, xQueue2;
struct AMessage *pxMessage;

   // Create a queue capable of containing 10 uint32\_t values.
   xQueue1 = xQueueCreate( 10, sizeof( uint32\_t ) );

   // Create a queue capable of containing 10 pointers to AMessage structures.
   // These should be passed by pointer as they contain a lot of data.
   xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );

   // ...

   if( xQueue1 != 0 )
   \{
    // Send an uint32\_t.  Wait for 10 ticks for space to become
    // available if necessary.
    if( xQueueGenericSend( xQueue1, ( void * ) \&ulVar, ( TickType\_t ) 10, queueSEND\_TO\_BACK ) != pdPASS )
    \{
        // Failed to post the message, even after 10 ticks.
    \}
   \}

   if( xQueue2 != 0 )
   \{
    // Send a pointer to a struct AMessage object.  Don't block if the
    // queue is already full.
    pxMessage = \& xMessage;
    xQueueGenericSend( xQueue2, ( void * ) \&pxMessage, ( TickType\_t ) 0, queueSEND\_TO\_BACK );
   \}

   // ... Rest of task code.
\}
\end{DoxyPre}
 